<template>
	<view class="p-30 bg-white" style="min-height: 100vh;">
		<view v-if="withdrawTip==false">
			<view class="bg-white border-radius-lg box-shadow p-40 d-flex justify-content-between align-items-center">
				<view class="d-flex align-items-center">
					<view class="ft16 text-color-assist">当前金币</view>
				</view>
				<view class="ft16 ftw600 text-color-base">$ {{golds}}</view>
			</view>
			<view class="mt-40 bg-white border-radius-lg box-shadow p-40">
				<view class="ft16 text-color-assist">提现金币</view>
				<view class="d-flex align-items-center mt-30">
					<text class="ft32 ftw600">$</text>
					<input type="number" style="width:300rpx;height: 80rpx;" v-model="nums" class="ft32 ftw600 pl-10"/>
				</view>
			</view>
			<view class="mt-20 d-flex ft14 text-color-assist">*提现将扣除6%的手续费，最少提现10个金币，1个金币等价1元；1-7个工作日到您绑定的微信零钱</view>
			<view class="mt-40">
				<button v-if="isWithdraw" type="primary" class="border-radius-lg ft18 text-color-white ftw600" @tap="confirmWithdraw">确认提现</button>
				<button v-else type="default" class="border-radius-lg ft18 text-color-white ftw600">无可提现金币</button>
			</view>
		</view>
		
		<view v-if="withdrawTip == true">
			<view class="withdraw-main bg-white">
				<view class="text-center">
					<image class="withdraw-status" :src="statics.yesImg"></image>
				</view>
				<view class="text-center ft18 text-color-base ftw600">提现申请成功</view>
				<view class="text-center ft16 text-color-assist mt50">
					我们会在1-7个工作日内审核并完成转账
				</view>
				<view class="d-flex just-content-center mt-50">
					<button class="btn-mid" @tap="back">知道了</button>
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	export default{
		data(){
			return {
				golds:0,
				nums:'',
				isWithdraw:false,
				withdrawTip:false,
			}
		},
		onLoad(options) {
			this.golds = options.golds
			this.isWithdraw = this.golds==0?false:true;
		},
		methods:{
			confirmWithdraw() {
				if(!this.nums) {
					this.$u.toast("请输入提现金额！");return;
				}
				
				if(this.nums==0) {
					this.$u.toast("提现金额不能为0！");return;
				}
				
				if(this.nums>this.golds) {
					this.$u.toast("提现金额不能大于金币余额！");return;
				}
				
				uni.showLoading({
					mask: true,
					title: '申请提交中...'
				});
				
				this.withdrawTip = true;
				uni.hideLoading();
			},
			back() {
				uni.navigateBack();
			}
		}
	}
</script>

<style>	
	.withdraw-main{
		padding-top: 80rpx;
	}	
	.withdraw-status{
		width: 300rpx;
		height: 300rpx;
	}
	
	.money-icon{
		width: 80rpx;
		height: 80rpx;
	}
	.tag-money{
		width:180rpx;
		height:100rpx;
		background:#FFFFFF;
		border-radius:50rpx;
		border:4rpx solid #E6E6E6;
		color:#333333;
		font-size: 32rpx;
		font-weight: 600;
	}
	.tag-money.on{
		border:none;
		background: #FF6D00;
		color:#FFFFFF;
	}
</style>